package xyz.weizhi.tanhua.appserver.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import xyz.weizhi.tanhua.appserver.service.CommentsService;
import xyz.weizhi.tanhua.model.mongo.Comment;
import xyz.weizhi.tanhua.model.vo.PageResult;

/**
 * @Author milian
 * @Date 2021/10/27 0027 20:27
 */
@RestController
@RequestMapping("/comments")
public class CommentsController {
    @Autowired
    private CommentsService commentsService;
    /*
        获取动态评论
     */
    @GetMapping
    public ResponseEntity comments(String movementId, @RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "10") Integer pagesize){
        PageResult pageResult = commentsService.comments(movementId, page, pagesize);
        return ResponseEntity.ok(pageResult);
    }

    /*
        提交动态
     */
    @PostMapping
    public ResponseEntity pubulish(@RequestBody String movementId,@RequestBody String comment){
        commentsService.pubulish(movementId,comment);

        return null;
    }


}

